<?php
class Zend_View_Helper_LoginData extends Zend_View_Helper_Abstract
{
	public function loginData ()
	{
		$auth = Zend_Auth::getInstance();
		if ($auth->hasIdentity()) {
			$username = $auth->getIdentity()->username;
			$role = $auth->getIdentity()->userrole;
				
			$username = $auth->getIdentity()->username;
			$logoutUrl = $this->view->url(array('controller'=>'authenticate', 'action'=>'logout'), null, true);
			return 'Logged in as '.$username.' ('. $role .') - <a href="'.$logoutUrl.'">Logout</a>';
		}


	}
}
